﻿#-*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# Name:        for circulation循环
# Purpose:
# Author:      SUMMVING
# Email:       summving@gmail.com
# Created:     2013/08/13  21:26
# Copyright:   (c) SUMMVING 2013
# Licence:     GPLv3
#-------------------------------------------------------------------------------

for h in "123":          #建立一个字符串，结尾必须有冒号：
    print "haha"         #将输出3行haha


for i in range(1,8,2):   #range函数，从1数到7，不包括8，间隔为1
    print i,             #输出：1，3，5，7

j = 0
for k in range(1,101,1):
    j = j + k            #计算1加到100
print "j = ",j

print '----'

"""for里面的嵌套"""
for x in range(1,13):
    print 'x =',x
    if x == 3:
       pass              #pass 作用代码桩，用于占位，为今后代码做预留
    if x == 8:
       print "nest 113"  #当x恒等于8时，输出nest 113
       continue
#    if x == 9:
#       exit()           #当x==9时退出整个程序
    if x ==11:           #当x恒等于11时，退出判断语句
       break             #此时已经退出判断，不在执行下面的语句
    print "$"*10         #打印10个$
else:
     print "ending"








